import tkinter as tk
from tkinter import filedialog,messagebox as msgbox

# 建一个方法，获取所选择的文件夹下所有的文件名的路径
def get_file_path(dir):
    file_paths = []
    for root, dirs, files in os.walk(dir):
        for file in files:
            file_path = os.path.join(root, file)
            file_paths.append(file_path)
    return file_paths

# 打开文件对话框，选择文件夹
def open_file_dialog():
    root = tk.Tk()
    root.withdraw()
    file_path = filedialog.askdirectory()
    if file_path:
        return file_path
    return None
# 打开文件对话框，选择Excel文件
def open_excel_dialog():
    root = tk.Tk()
    root.withdraw()
    file_path = filedialog.askopenfilename()
    if file_path:
        return file_path
    return None
def show_message(message, x):
    if x == 0:
        msgbox.showerror('错误提示', message)
    else:
        msgbox.showinfo('温馨提示', message)

"""
   检查文件夹是否存在，如果不存在则创建。
   :param folder_path_list: 文件夹路径
   """
import os


def create_folder_if_not_exists(folder_path_list):
    for folder_path in folder_path_list:
        if not os.path.exists(folder_path):
            os.makedirs(folder_path)

